import Mongoose from 'mongoose'
import { Movie } from '../entities/Movie'

export interface IMovie extends Movie, Mongoose.Document { }

const movieSchema = new Mongoose.Schema<IMovie>({
    name: { type: String, required: true },
    types: { type: [String], required: true },
    areas: { type: [String], required: true },
    timeLong: { type: Number, required: true },
    isHot: { type: Boolean, default: false },
    isComing: { type: Boolean, default: false },
    isClassic: { type: Boolean, default: false },
    description: { type: String },
    poster: { type: String },
}, {
    versionKey: false,
})

export default Mongoose.model<IMovie>('Movie', movieSchema)